package org.example.order.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.misc.model.Result;
import org.example.order.contract.request.OrderRequestForSave;
import org.example.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
@Slf4j
public class OrderController {

    @Autowired
    private OrderService orderService;

    Result<Long> saveOrder(@RequestBody OrderRequestForSave request) {
        Long orderId = orderService.saveOrder(request);
        return Result.ok(orderId);
    }
}
